<template>
  <el-select :value="value" @change="handleChange">
    <el-option
      v-for="item in options"
      :key="item.id"
      :label="item.value"
      :value="item.id"
    />
  </el-select>
</template>
<script>
import { mapState } from 'vuex'
export default {
  props: {
    type: {
      type: String,
      default: 'merchant_type'
    },
    value: String
  },
  data() {
    return {}
  },
  computed: {
    ...mapState({
      options: function(state) {
        return state.common[this.type] // 要取this的实例，只能用不同函数，不能用箭头函数
      }
    })
  },
  methods: {
    handleChange(value) {
      this.$emit('input', value)
    }
  }
}
</script>
<style lang="scss" scoped>

</style>
